/*
 * User
 */
function U(data)
{
	var mode = data['mode']; // local user or Facebook user
	var uid, username, imgURL;
	
	this.lat = data['lat'];
	this.lng = data['lng'];
	uid = data['id']; // user id
	username = data['username']; // user name
	imgURL = data['imgURL']; // user picture filename
	/*
	switch(mode)
	{
		case 'local' :
			
		break;
		// initialize with facebook info
		case 'fb' :
			// get uid
			FB.api('/me', function(response) {
				uid = response.id;
			});
		break;
	}*/
	
	/*
	 * PUBLIC
	 * get box with user info
	 */
	
	this.displayInfo = function(uid)
	{
		$msg = '<div>'
			+  '<img class="pull-left photo-small" src="'+displayPhoto()+'">'
			+  name ;
			+  '</div>';
		return $msg;
	};
	
	/*
	 * PRIVATE
	 * get path for user photo
	 */
	this.displayPhoto = function()
	{
		switch(mode)
		{
			case 'local' :
				if(imgURL != 'empty')
				{
					return '/'+BASEPATH+'assets/uploads/'+uid+'/'+imgURL;
				}
				else
				{
					return '/'+BASEPATH+'assets/uploads/nophoto.png';
				}
			break;
			case 'facebook' :
				return 'https://graph.facebook.com/'+uid+'/picture';
			break;
		}
	};
	
	/*
	 * PUBLIC
	 * get data about the user
	 */
	this.getUid = function()
	{
		return uid;
	};
	
	this.getImgURL = function()
	{
		return imgURL;
	};
	
	this.getUsername = function()
	{
		console.log(username);
		return username;
	};
}